# -*- coding: utf-8 -*-

"""
针对字符串处理的工具类
"""

import jieba
import re

"""
分词结果附带标点符号
"""
WITH_SYMBOL = 1
"""
分词结果排除标点符号
"""
WITHOUT_SYMBOL = 2


def participle(str, mod=WITH_SYMBOL):
    words = list(jieba.cut(str))
    if mod == WITHOUT_SYMBOL:
        tmp = []
        for i in range(len(words)):
            # 判断是否为符号
            if is_symbol(words[i]) is not True:
                tmp.append(words[i])
                pass
            pass
        words = tmp
        pass
    return words
    pass


def is_symbol(str):
    """
    判断的规则
    是否存在某个字符 不是中文 数字 英文
    :param str:
    :return:
    """
    p = re.compile('[^\u4e00-\u9fa5\w]')
    m = p.findall(str)
    if len(m) > 0:
        return True
    return False
    pass


def spilt_use_space(resume_str):
    """
    对简历文件进行初步分隔
    暂时只分隔空格
    :param resume_str:
    :return:
    """
    # 根据1个或多个空格分隔字符串
    p = re.compile(r'\s{1,}')
    ss = p.split(resume_str.strip())
    return ss
    pass


a = '职意向：A'
print(is_symbol(a))
